package com.jyx.bank;

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.FileReader;
import java.io.FileWriter;

public class FileIO {
	double number;
	String name;
	String pin;
	String fname;
	FileIO (String cname){
		fname = cname;
		number = 0;
		name = null;
		pin = null;
	}
	public void innumber(String iname,String ipin,double inumber){
		name = iname;
		pin = ipin;
		number = inumber;
	}
	public void input () {
		try{
			BufferedReader br = new BufferedReader(new FileReader(fname));
			name = br.readLine();
			if(name == null){
				return;
			}
			pin = br.readLine();
			number = Double.parseDouble(br.readLine());
			br.close();
			}catch(Exception d) {}
		}
	public void output (){
		try{
			BufferedWriter ot = new BufferedWriter(new FileWriter(fname));  
			ot.write(name+"\r\n");
			ot.write(pin+"\r\n");
			ot.write(Double.toString(number)+"\r\n");
			ot.close();  
			}catch(Exception d) {}
		
		}
	public String RN (){
		return name;
	}
	public String RP (){
		return pin;
	}
	public double RNu(){
		return number;
	}
}
